const app =getApp();
Page({
  data: {
  },
  onLoad() {
    const that = this;
    app.request('/api/user/examList', {question_category_id: app.globalData.category.id}).then(res => {
      console.log(res.data);
      let max = 0;
      let total = 0;
      for (const item of res.data.data.list) {
        if (max < item.true_num) {
          max = item.true_num;
          total = item.true_num + item.false_num;
        }
      }
      that.setData({
        examList: res.data.data.list,
        total: total,
        max: max
      });
      if (res.data.data.list.length > 0) {
        that.canvasRing = that.selectComponent('#canringA');
        that.canvasRing.drawCanvasRing(); // 绘制圆环A
      }
    }).catch(err => {
      console.error(err);
    })
  },
})
